﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>
<%

        Action=Request.QueryString("Action")
        urls=Request.QueryString("urls")
        nid=Request.QueryString("nid")
	if nid="" then nid=1
	if not isnumeric(nid) then nid=1
	nid=clng(nid)
        if urls="" then urls="index.asp"
        if Action="" then Action="pay1"
        qingtian.info

if sid<>"Null" then
Set Rs = Server.CreateObject("Adodb.Recordset")
Sql1 = "select [name],[tupic],[paym],[zbit],[zmeili],[ztili],[zjifen],[zvip],[touxian],[xunzan] from [qingtian_shangpin] where [nid]="&nid
		Rs.Open Sql1,conn,1,1
		if not (rs.bof and rs.eof) then
                topic=rs("tupic")
                name1=rs("name")
                zbit=rs("zbit")
                ztili=rs("ztili")
                zmeili=rs("zmeili")
                zjifen=rs("zjifen")
                zvip=rs("zvip")
                ztouxian=rs("touxian")
                zxunzannn=rs("xunzan")
                zxunzan="<img src="""&zxunzannn&""" alt="""&name1&""" noselect =""true""/>"
                else
if v=0 then
Response.Write("<card title=""出错了""><p align="""&qingtian.px&""">")
else
Response.Write("<title>出错了</title></head><body>")
end if
                qingtian.err("该商品不存在")
			end if
			Rs.close
Sql2 = "select [id],[meili],[tili],[money],[vip],[viptime],[zf],[touxian],[xunzhan] from [qingtian_user] where sid= '" & qingtian.Formatsid(sid) & "'"
		Rs.Open Sql2,conn,1,1
		if not (rs.bof and rs.eof) then
                tid=rs("id")
                meili=rs("meili")
                tili=rs("tili")
                money=rs("money")
                vip=rs("vip")
                viptime=rs("viptime")
                zf=rs("zf")
                touxian=rs("touxian")
                xunzhan=rs("xunzhan")
			end if
                        Rs.close
Sql2 = "select [page],[lib] from [qingtian_chuwu] where [nid]="&nid&" and [bid]="&tid
		Rs.Open Sql2,conn,1,1
		if not (rs.bof and rs.eof) then
                pag=rs("page")
                lib=rs("lib")
                if lib=1 then
if v=0 then
Response.Write("<card title=""出错了""><p align="""&qingtian.px&""">")
else
Response.Write("<title>出错了</title></head><body>")
end if
                qingtian.err("该商品不存在")
                end if
			end if
			Rs.close
                        set rs=nothing
	page=Request("page")
        page=qingtian.repsql(page)
	if page="" or clng(page)<1 or clng(page)>clng(pag) then page=1
	if not isnumeric(page) then page=1
	page=clng(page)
if pag=0 then
Response.Redirect "/user/chuwu.asp?act=2&sid="&sidd
end if
select case v
case "0" 
we0="<br/>"
hr="-------------------<br/>"
book="<input name='page' format='*N' size='4' maxlength='5'/>个<anchor>提交<go href='shiyong.asp?Action=pay2&amp;nid="&nid&"&amp;sid="&sidd&"' method='post'><postfield name=""page"" value=""$(page:n)"" /></go></anchor><br/>"
title="<card title=""使用商品""><p align="""&qingtian.px&""">"
case "1"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
book=""&dao&"<form action=""shiyong.asp?Action=pay2&amp;sid="&sidd&"&amp;nid="&nid&""" method=""post""><input type=""text"" name=""page"" value="""" format=""*N"" size=""4"" maxlength=""5""/>个<input type=""submit"" value=""提交""/></form>"&we0&""
title="<title>使用商品</title></head><body>"
End Select		
select case Action
case "pay1"
 if zmeili<>0 then 
bookt="增加魅力"&zi&""&zmeili&"点"&zi0&","
 end if 
 if ztili<>0 then 
bookt="增加体力"&zi&""&ztili&"点"&zi0&","+bookt
end if 
 if zjifen<>0 then
bookt="增加积分"&zi&""&zjifen&"点"&zi0&","+bookt
 end if 
 if zbit<>0 then
bookt="增加"&qingtian.bi&""&zi&""&zbit&"个"&zi0&","+bookt
 end if 
if zvip<>0 then 
bookt="增加VIP"&zi&""&zvip&"个月"&zi0&","+bookt
 end if
if ztouxian<>"" then 
bookt="让你的头像改变成<img src='"&ztouxian&"' alt='"&qingtian.utf8(name1)&"' noselect = ""true"" />(建议使用一个)"+bookt
 end if
if zxunzannn<>"" then 
bookt="增加勋章"&zxunzan&"(建议只使用一个)"+bookt
 end if
%>
<%=title%><%=qingtian.qingsav("332")%>
<%=we%>你要使用"<%=name1%>"使用后能够<%=bookt%>我要使用<a href="shiyong.asp?Action=pay2&amp;page=1&amp;nid=<%=nid%>&amp;sid=<%=sidd%>">1个</a>,<a href="shiyong.asp?Action=pay2&amp;page=<%=pag%>&amp;nid=<%=nid%>&amp;sid=<%=sidd%>"><%=pag%>个</a>,或输入个数:(最小1个,最多<%=pag%>个)<%=we0%><%=book%><%=we%>你有:<%=zi%><%=pag%>个<%=name1%><%=zi0%><br/>
<a href="viewdaoju.asp?nid=<%=nid%>&amp;sid=<%=sidd%>">返回上级页面</a><%=we0%><%=qingtian.qingsav("333")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<%
case "pay2"
Session.Abandon
%>
<%=title%><%=qingtian.qingsav("332")%>

<%=we%>请确认你要使用<%=page%>个"<%=name1%>"!<br/><a href="shiyong.asp?Action=pay3&amp;page=<%=page%>&amp;nid=<%=nid%>&amp;sid=<%=sidd%>">[确认使用]</a><br/>你有:<%=zi%><%=pag%>个<%=name1%><%=zi0%><br/>马上<a href="chongzhi.asp?sid=<%=sidd%>">充值我的<%=qingtian.bit%></a><br/>
<a href="pay.asp?nid=<%=nid%>&amp;sid=<%=sidd%>">返回上级页面</a><%=we0%><%=qingtian.qingsav("333")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<%

case "pay3"

%>
<%=title%><%=qingtian.qingsav("332")%>
<%
if clng(pag)>=clng(page) then
if session("tr")=1 then
%>
<%=we%>使用失败,请不要重复刷新!<br/>
<a href="shiyong.asp?Action=pay1&amp;nid=<%=nid%>&amp;sid=<%=sidd%>">返回上级页面</a><%=we0%><%=qingtian.qingsav("333")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<%   
else
 if DATEDIFF("d",viptime,now()) >= 0 then 
viptime=now()
 end if
 if  zmeili<>0 then 
bookt="增加魅力"&zi&""&page*zmeili&"点"&zi0&","
 end if 
if ztouxian<>"" then 
bookt="将头像改变成<img src='"&ztouxian&"' alt='"&qingtian.utf8(name1)&"' noselect = ""true"" />"+bookt
 end if
if zxunzannn<>"" then 
bookt="增加勋章"&zxunzan&""+bookt
 end if
 if ztili<>0 then 
bookt="增加体力"&zi&""&page*ztili&"点"&zi0&","+bookt
end if 
 if zjifen<>0 then 
bookt="增加积分"&zi&""&page*zjifen&"点"&zi0&","+bookt
 end if 
 if zbit<>0 then
bookt="增加"&qingtian.bi&""&zi&""&page*zbit&"个"&zi0&","+bookt
 end if 
if zvip<>0 then 
vip=1
bookt="增加VIP"&zi&""&page*zvip&"个月"&zi0&","+bookt
zvip=page*zvip
if DATEDIFF("d",viptime,now()) >= 0 then 
viptime=dateadd("m",zvip,now())
else
viptime=dateadd("m",zvip,viptime)
end if
Set Rs = Server.CreateObject("Adodb.Recordset")
Sql = "select top 1 [viptime],[xunzhan] from qingtian_user where sid='"&qingtian.Formatsid(sid)&"'"
Rs.Open Sql,conn,1,3
if not (rs.bof and rs.eof)  then
rs("viptime")=viptime
if InStr(rs("xunzhan"),topic) > 0 Then
rs("xunzhan")=rs("xunzhan")
else
rs("xunzhan")="<img src="""&topic&""" alt=""VIP"" noselect =""true""/>" & rs("xunzhan")
end if
rs.update
end if
Rs.close
set rs=nothing
 end if
if lib=3 then
conn.execute("update qingtian_user set [touxian]='"&ztouxian&"' where sid= '" & qingtian.Formatsid(sid) & "'")
elseif lib=4 then
for i=1 to page
zxunza=zxunza & zxunzan
next
conn.execute("update qingtian_user set [xunzhan]='"&xunzhan&zxunza&"' where sid= '" & qingtian.Formatsid(sid) & "'")
else
conn.execute("update qingtian_user set [meili]="&meili+page*zmeili&",[tili]="&tili+page*ztili&",[zf]="&zf+page*zjifen&",[money]="&money+page*zbit&",[vip]="&clng(vip)&" where sid= '" & qingtian.Formatsid(sid) & "'")
end if
conn.execute("update qingtian_chuwu set [page]="&clng(pag)-page&" where bid="&clng(tid)&" and nid="&nid&"")
qingtian.addong("使用了"&page&"个"&name1&"[img]"&topic&"[/img]")
session("tr")=1
%>
<%=we%>你使用了<%=page%>个<%=name1%>,系统为你<%=bookt%><br/>你现在还剩余<%=zi%><%=pag-page%>个<%=name1%><%=zi0%><br/><a href="shiyong.asp?nid=<%=nid%>&amp;sid=<%=sidd%>">继续返回使用</a><%=we0%><%=qingtian.qingsav("333")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<% 
end if  
else
%>
<%=we%><%=we0%>
<%=we%>出错了!你的<%=name1%>不足!<br/>你现在的<%=name1%>为:<%=zi%><%=pag%><%=bi%><%=zi0%><br/>马上<a href="chongzhi.asp?sid=<%=sidd%>">充值我的<%=qingtian.bit%></a><br/>
<a href="shiyong.asp?nid=<%=nid%>&amp;sid=<%=sidd%>">返回上级页面</a><%=we0%><%=qingtian.qingsav("333")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<% 
end if 

End Select
else
Response.Redirect "/login.asp?sid=" & sidd & "&url=/user/shiyong.asp?sid="&sidd&"@@nid="&nid

end if		
end Function
%>
